home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / AboveBelow.dxr / playing cards_56_tableau cards.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  2.5 KB  |  93 lines

  1. property spriteNum, motion, location, row
  2. global tableau, getlist, equal, currentsel, godlist, foundation, points, stock, rightlist, leftlist
  3.  
  4. on beginSprite me
  5.   if not listp(tableau) then
  6.     tableau = [:]
  7.   end if
  8.   row = determinerow()
  9.   if not objectp(tableau[row]) then
  10.     tableau.addProp(row, new(script("card pile")))
  11.   end if
  12.   location = sprite(spriteNum).loc
  13. end
  14.  
  15. on mouseDown me
  16.   if tableau[row].getcardcount() > 0 then
  17.     if spriteNum = tableau[row].getlastcard().spnum then
  18.       puppetSound(3, member("pick card", "100GPak Generic SFX"))
  19.       sprite(spriteNum).locZ = spriteNum + 1000
  20.       getlist = tableau[row]
  21.       motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
  22.     end if
  23.     if sprite(spriteNum).member = member("empty", "playing cards") then
  24.       sendSprite(spriteNum - 1, #mouseDown)
  25.     end if
  26.   end if
  27. end
  28.  
  29. on moving me
  30.   if the mouseDown then
  31.     sprite(spriteNum).loc = the mouseLoc
  32.   else
  33.     if the mouseUp then
  34.       sprite(spriteNum).locZ = spriteNum
  35.       motion.forget()
  36.       abort()
  37.     end if
  38.   end if
  39. end
  40.  
  41. on mouseUp me
  42.   if equal then
  43.     puppetSound(3, member("pick card", "100GPak Generic SFX"))
  44.     sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
  45.     sprite(spriteNum).member = member("empty", "playing cards")
  46.     godlist.addCard(currentsel)
  47.     sprite(spriteNum).loc = location
  48.     tableau[row].cards.deleteOne(tableau[row].getlastcard())
  49.     if currentsel <> 38 then
  50.       if objectp(foundation[sprite(currentsel).row]) then
  51.         points = points + 10
  52.       end if
  53.     end if
  54.     equal = 0
  55.     currentsel = 0
  56.     godlist = VOID
  57.     getlist = VOID
  58.     repeat with i = 96 to 99
  59.       if tableau[sprite(i).row].getcardcount() = 0 then
  60.         next repeat
  61.       end if
  62.       sprite(i).loc = tableau[sprite(i).row].getlastcard().location
  63.     end repeat
  64.     checkwin()
  65.   else
  66.     if not equal then
  67.       if sprite(spriteNum).member.name <> "empty" then
  68.         puppetSound(3, member("drop card", "100GPak Generic SFX"))
  69.         getlist = VOID
  70.         sprite(spriteNum).loc = location
  71.       end if
  72.     end if
  73.   end if
  74. end
  75.  
  76. on determinerow me
  77.   if (spriteNum >= 40) and (spriteNum <= 53) then
  78.     return #one
  79.   else
  80.     if (spriteNum >= 54) and (spriteNum <= 67) then
  81.       return #two
  82.     else
  83.       if (spriteNum >= 68) and (spriteNum <= 81) then
  84.         return #three
  85.       else
  86.         if (spriteNum >= 82) and (spriteNum <= 95) then
  87.           return #four
  88.         end if
  89.       end if
  90.     end if
  91.   end if
  92. end
  93.